const player = {
    state: {
        currIndex: 0,
        playerParams: {
            name: '',
            dragReal: true,
            width: '45%',
            show: false,
            currIndex: 0,
            times: []
        },
        playerTime: '',
    },
    mutations: {
        PLAYERARAMS: (state, playerParams) => {
            state.playerParams = playerParams
        },
        PLAYERINDEX: (state, currIndex) => {
            state.currIndex = currIndex
        },
        PLAYERTIME: (state, playerTime) => {
            state.playerTime = playerTime
        },
        PLAYERCLOSE: (state, playerParams) => {
            state.playerParams = {
                name: '',
                dragReal: true,
                show: false,
                currIndex: 0,
                times: []
            }
        }
    },
    actions: {
        playerParams: ({ commit }, playerParams) => {
            commit('PLAYERARAMS', playerParams)
        },
        playerClose: ({ commit }) => {
            commit('PLAYERCLOSE')
        },
        playerIndex: ({ commit }, playerIndex) => {
            commit('PLAYERINDEX', playerIndex)
        },
        playerTime: ({ commit }, playerTime) => {
            commit('PLAYERTIME', playerTime)
        }
    }
}

export default player
